﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using KPIS.GERP.Models.ViewModel;

namespace KPIS.GERP.SERVICE.WorkflowService.WCFService
{
    public static class ServerVariables
    {
        static ServerVariables()
        {
            InitialStartLog = new VMInitialStartLog();
        }

        public static VMInitialStartLog InitialStartLog { get; set; }
    }

    [ServiceContract]
    public interface IWakeUpService
    {
        [OperationContract]
        void WakeUp();

        [OperationContract]
        VMInitialStartLog GetInitialTime();
    }

    public class WakeUpService : IWakeUpService
    {
        public void WakeUp()
        {
            ServerVariables.InitialStartLog.Start();

            // Mock Connection
            var bllEmployee = new KPIS.GERP.SERVICE.DAL.Employee();
            var employee = bllEmployee.GetHrmPsEmployeeLite();


            ServerVariables.InitialStartLog.FinishedInitial();
        }

        public VMInitialStartLog GetInitialTime()
        {
            return ServerVariables.InitialStartLog;
        }
    }
}
